package com.flashflexpro.flexdirector.console.utils {
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;

public class ClassUtil {
    public static function isAllInstOf1Class(arr:Vector.<Object>, cls:Class = null):Boolean {
        for each(var inst:Object in arr) {
            if (cls == null) {
                cls = getDefinitionByName(getQualifiedClassName(inst)) as Class;
            }
            else if (inst is cls) {
                continue;
            }
            return false;
        }
        return true;
    }

    [Test]
    public function quickTest():void {
        var inst = new ClassUtil();
        var str:String = getQualifiedClassName(inst);
        var def:*;
        try {
            def = getDefinitionByName(str);
            var inst2 = new def();
        } catch(e:Error) {
            trace(e.getStackTrace());
        }

        trace("-->" + str);
        str = str.replace("::", ".");
        trace(str);
        try {
            def = getDefinitionByName(str);
            var inst3 = new def();

        } catch(e:Error) {
            trace(e.getStackTrace());
        }

    }

    [Test]
    public function test():void{
        var s:String = "1111" + true?"Begin":"End";
        var ss:String = "2222" + false?"Begin":"End";
        trace( "" + s + "" + ss );
    }

}
}